export default {
  namespaced: true,
  state: {
    beCalling: true, // 被呼叫中
    isSilence: false, // 是否静音
    isSpeaker: false, // 是否开扬声器
    isWait: true, // 是否等待对方进入房间
    isVideo: false, // 是否在视频通话中
    isSmallWindow: false, // 是否是小窗口
    isStop: false, // 挂机
    videoDevices: [],
    videoDeviceId: '',
    showCall: true
  },
  getters: {
    beCalling: state => state.beCalling,
    isSilence: state => state.isSilence,
    isSpeaker: state => state.isSpeaker,
    isWait: state => state.isWait,
    isVideo: state => state.isVideo,
    isSmallWindow: state => state.isSmallWindow,
    videoDevices: state => state.videoDevices,
    videoDeviceId: state => state.videoDeviceId,
    showCall: state => state.showCall
  },
  mutations: {
    setBeCalling(state, beCalling) {
      state.beCalling = beCalling;
    },
    setWait(state, isWait) {
      state.isWait = isWait;
    },
    setVideo(state, isVideo) {
      state.isVideo = isVideo;
    },
    setShowCall(state, showCall) {
      state.showCall = showCall;
    },
    setVideoDeviceInfo(state, obj) {
      state.videoDeviceId = obj.deviceId || '';
      state.videoDevices = obj.videoDevices || [];
    },
    setSilence(state, isSilence) {
      state.isSilence = isSilence;
    },
    setSpeaker(state, isSpeaker) {
      state.isSpeaker = isSpeaker;
    },
    setSmallWindow(state, isSmallWindow) {
      state.isSmallWindow = isSmallWindow;
    },
    resetCall(state) {
      state.videoDevices = [];
      state.videoDeviceId = '';
      state.beCalling = true;
      state.isSpeaker = false;
      state.isSilence = false;
      state.isWait = true;
      state.isVideo = false;
      state.isSmallWindow = false;
      state.showCall = false;
    }
  }
};
